//
//  CALayer+CALayer_XibConfiguration.m
//  RecruitPlatformAPP
//
//  Created by 谷峰 on 2018/3/7.
//  Copyright © 2018 - 2019 gw. All rights reserved.
//

#import "CALayer+CALayer_XibConfiguration.h"

@implementation CALayer (CALayer_XibConfiguration)
- (void)setBorderUIColor:(UIColor*)color
{
    self.borderColor = color.CGColor;
    self.borderWidth = 1;
}
- (void)setCornerUIRadius:(CGFloat)cornerUIRadius{
    self.masksToBounds = YES;
    self.cornerRadius = cornerUIRadius;
    
}
- (CGFloat)cornerUIRadius{
    return self.cornerRadius;
}
- (UIColor *)borderUIColor
{
    return [UIColor colorWithCGColor:self.borderColor];
}

- (void)setShadowUIColor:(UIColor*)color
{
    self.shadowColor = color.CGColor;
}

- (UIColor *)shadowUIColor
{
    return [UIColor colorWithCGColor:self.shadowColor];
}
+ (instancetype)createMaskLayerWithView : (UIView *)view{
   CGFloat viewHeight = CGRectGetHeight(view.frame);
   CGFloat topSpace = 18.;
   CGFloat hSpace = 12.;
   CGPoint point1 = CGPointMake(topSpace,hSpace);
   CGPoint point2 = CGPointMake(topSpace+topSpace, hSpace);
   CGPoint point3 = CGPointMake(topSpace+25, 0);
   CGPoint point4 = CGPointMake(topSpace+32, hSpace);
  //左上右下圆角
  UIBezierPath*path=[UIBezierPath bezierPathWithRoundedRect:CGRectMake(topSpace, hSpace, view.frame.size.width-20, viewHeight-hSpace)  byRoundingCorners: UIRectCornerAllCorners cornerRadii:CGSizeMake(10,10)];
 
  [path moveToPoint:point1];
  [path addLineToPoint:point2];
  [path addLineToPoint:point3];
  [path addLineToPoint:point4];
  CAShapeLayer *layer = [CAShapeLayer layer];
  layer.path = path.CGPath;
 
  return layer;
}
@end
